/**********************************************************************************
WIKINDX: Bibliographic Management system.
Copyright (C)

This program is free software; you can redistribute it and/or modify it under the terms 
of the GNU General Public License as published by the Free Software Foundation; either 
version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; 
if not, write to the 
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

The WIKINDX Team 2007
sirfragalot@users.sourceforge.net

$Header: /cvsroot/wikindx/wikindx3/templates/classic/template.js,v 1.5 2007/06/03 14:52:57 sirfragalot Exp $

**********************************************************************************/

/**
* template.js
*
* This file provides the opportunity to alter the CSS display dependent upon certain browsers and to set up the button properties for the 
* format bar in the word processor (SUWP) and the paper dimensions.
* template.js is loaded from header.tpl.
* initTemplate() is called in the onLoad function of the body tag in body.tpl and bodySUWP.tpl.
* The minimum template.js should look like:

var buttonBaseColor = "some colour";
var buttonMouseOverColor = "some colour";
var buttonMouseDownColor = "some colour";
function initTemplate()
{
}
*/

//base color, mouseOver color, mouseDown color for the SUWP format bar buttons
// These must be set.
var buttonBaseColor = "#c8c8fa";
var buttonMouseOverColor = "#cccccc";
var buttonMouseDownColor = "#a6a6d8";

var agt=navigator.userAgent.toLowerCase();
var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
                && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
                && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
var is_opera = (agt.indexOf("opera") != -1);
var is_win   = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
var is_mac    = (agt.indexOf("mac")!=-1);
var is_safari = (agt.indexOf("safari") != -1);
var is_konqueror = (agt.indexOf("konqueror") != -1);
var is_gecko = (agt.indexOf("gecko") != -1);

function initTemplate() // called from body.tpl and bodySUWP.tpl
{
	cssFix();
}

// Various CSS fixes dependent upon the browser.
function cssFix()
{
// Set the dimensions of the SUWP paper area
// browserHeight and browserWidth are set internally
	if (document.getElementById('paperText')) {
		document.getElementById('paperText').style.height = (browserHeight * 0.75) + "px";
		document.getElementById('paperText').style.width = (browserWidth * 0.9) + "px";
	}
	if (document.getElementById('menuTable')) {
		if (is_ie) {
			document.getElementById('menuTable').style.margin = "0% 0% 0% 1.5%";
			if(document.getElementById('formatBarDiv'))
				document.getElementById('formatBarDiv').style.left = "3.9%";
		}
		else if (is_opera) {
			document.getElementById('menuTable').style.margin = "0% 0% 0% 3%";
		}
		else if (is_konqueror) {
			document.getElementById('menuTable').style.margin = "0% 0% 0% 0%";
		}
	}
}
